<%# locals: remark %>
  <%# if !remark.new_record? %>
<div class="discussion-bubble" id="div_rsht_<%= remark.id %>">
    <%# div_tag "div_ri_", remark %>
  <% if !remark.author.nil? %>
  <a href="<%= user_path remark.author %>">
    <%= image_tag remark.author.avatar, width: 48, height: 48,
      'class' => 'discussion-bubble-avatar' %>
  </a>
  <% end %>
  <div class="discussion-bubble-content bubble">
    <div class="discussion-bubble-inner">

      <div class="comment-header" style="margin:0">
        <div class="left comment-header-author">
          <%= author_name remark %>
        </div>
        <div class="left">
          <%= get_remark_type_text remark %>
        </div>
        <div class="right">
          <ul class="inline-list">
            <li><%= date_text remark.created_at %></li>
            <% if !current_user.nil? && remark.author == current_user %>
            <li>
              <%= js_tag '编辑', { show: "red_#{remark.id}", hide: "ri_#{remark.id}" } %>
            </li>
            <% end %>
            <li><%= js_tag '回复', {
              "set('remark[parent_remark_id]','#{remark.id}')" =>
                 "form_rnt_#{remark.topic_id}",
              submit: "form_rnt_#{remark.topic_id}"
            } %></li>
          </ul>
        </div>
        <div class="clear"></div>
      </div>

      <div class="comment-content">

        <% if !remark.parent_remark.nil? %>
          <div class="quote">
            <%= render partial: 'remarks/sub_remark', locals: { remark: remark.parent_remark } %>
          </div>
        <% end %>

        <% if !remark.question_version.nil? %>
          <%= render remark.question_version %>
        <% end %>

        <div id="ri_<%= remark.id %>">
          <%=h raw (remark.get_linked_content) %>
          <% if (!remark.new_record?) && remark.updated_at - remark.created_at > 1.0 %>
            <div class="meta">
              最后修改：<%= remark.updated_at.localtime.to_s(:db) %>
            </div>
          <% end %>
        </div>
        <div id="red_<%= remark.id %>" style="display:none">
          <%= form_for remark, remote: true do |f| %>
            <dl style="margin-bottom:0">
              <dt><%= f.text_area :content %></dt>
              <dt>
                <%= f.submit '提交', 'class' => 'button primary' %>
                <%= button_tag '取消', type: 'button',
                  onclick: create_js({
                    hide: "red_#{remark.id}",
                    show: "ri_#{remark.id}"
                  }), 'class' => 'button'  %>
              </dt>
            </dl>
          <% end %>
        </div>

      </div>
    </div>
  </div>
  <div class="clear"></div>
    <%#/div%>
  <%# end %>
  <%# render partial: 'remarks/form', locals: { remark: remark } %>
</div>